[build] Do not modify assemblies in the NuGet package cache - #12450
Merged
jonathanpeppers merged 3 commits intoAug 20, 2026
Conversation
Add a red regression test for #11022 using Humanizer satellite assemblies from dotnet-public. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d50a004c-7088-4372-a35a-a824c74118be
Skip satellite resource assemblies when the post-link pipeline operates in place, while retaining them in the packaging item flow. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d50a004c-7088-4372-a35a-a824c74118be
jonathanpeppers
marked this pull request as ready for review
August 19, 2026 19:44
Contributor
There was a problem hiding this comment.
Pull request overview
This PR prevents Android builds from mutating *.resources.dll satellite assemblies located in the NuGet global package cache when the post-link AssemblyModifierPipeline runs in-place (marshal-methods path), avoiding timestamp changes and potential concurrent-build file lock collisions.
Changes:
- Filters
@(ResolvedAssemblies)so satellite*.resources.dllare excluded only from the in-place post-link modifier inputs. - Keeps satellite assemblies in the normal assembly flow so they can still be packaged as expected.
- Adds a regression test that restores Humanizer satellite assemblies, locks them, and verifies they aren’t modified by the build.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets | Excludes *.resources.dll from the in-place AssemblyModifierPipeline input list to avoid writing into NuGet package-cache paths. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs | Adds a regression test intended to ensure builds don’t modify locked NuGet satellite assemblies. |
Delete the incremental post-link stamp before exercising the marshal-method path and verify that the target recreates it. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d50a004c-7088-4372-a35a-a824c74118be
simonrozsival
approved these changes
Aug 20, 2026
jonathanpeppers
added a commit
that referenced
this pull request
Aug 21, 2026
…rites (#12463) ## Summary - Backports #11552 (`286b38c3109cd39b5512fcfd23530e7cbba7db6f`) so incremental `BuildArchive` updates retain unchanged JAR resources, replace updated entries, and remove stale entries correctly. - Backports #12450 (`66d3f745f5b231e5c82b78ee9fcf105f883dd9bd`) so in-place post-link processing excludes satellite assemblies from the NuGet package cache, while preserving normal packaging and non-in-place behavior. ## RC1 justification These are narrowly scoped customer-facing correctness and reliability fixes. They prevent stale or incorrect APK contents during incremental builds, prevent mutation of NuGet package-cache assemblies, and avoid concurrent-build XAAMP7024 failures caused by writes to shared cached satellite assemblies. There are no public API changes and no dependency changes. ## Validation - PASS: `BuildArchiveTests` — 4 passed, 0 failed. - PASS: `Xamarin.Android.Build.Tests` and its product dependencies compiled successfully with the host .NET 11 SDK after building the existing bootstrap task prerequisites. - PASS: `Xamarin.Android.Common.targets` XML validation. - The `BuildDoesNotModifyNuGetPackageCache` integration test compiled and started, but could not execute its nested app build because this checkout does not contain the repo-local SDK at `bin\Debug\dotnet\dotnet`; CI should provide full-build coverage. Upstream references: #11552 and #12450. Co-authored-by: Šimon Rozsíval <simon@rozsival.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Android builds must treat the NuGet global package cache as read-only. However, satellite
*.resources.dllfiles from NuGet packages were included inResolvedAssembliesand passed toAssemblyModifierPipelineusing their original package-cache paths.When marshal methods were enabled,
_RunAfterILLinkAdditionalStepsran this pipeline in place. Even unchanged assemblies had their timestamps updated, and concurrent builds could fail when they attempted to write the same cached file.Exclude satellite resource assemblies from the post-link modifier input only when the pipeline operates in place. The assemblies remain in the normal resolved-assembly flow, so they are still packaged, and non-in-place post-link processing is unchanged.
Add a regression test using
Humanizer.Core.esfrom the publicdotnet-publicfeed. It locks the package's resource assemblies and verifies that the build neither writes to them nor changes their timestamps.Tests
BuildDoesNotModifyNuGetPackageCacheCheckIncludedAssemblies(True, CoreCLR)Fixes #11022